package es.udc.fbellas.j2ee.tiendaweb.http.controller.actions;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import es.udc.fbellas.j2ee.tiendaweb.http.controller.session.SessionManager;
import es.udc.fbellas.j2ee.util.exceptions.InternalErrorException;
import es.udc.fbellas.j2ee.util.struts.action.DefaultAction;

public class LogoutAction extends DefaultAction{
	
    public ActionForward doExecute(ActionMapping mapping,
            ActionForm form, HttpServletRequest request,
            HttpServletResponse response)
            throws IOException, ServletException, InternalErrorException {
            
            /* Do logout. */
            SessionManager.logout(request, response);
            
            /* Return ActionForward. */    
            return mapping.findForward("MainPage");
        
        }
}
